package com.njtoyo.taxi.admin.rest.controller.business.device;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njtoyo.taxi.admin.aop.PassToken;
import com.njtoyo.taxi.admin.aop.PermissionScope;
import com.njtoyo.taxi.admin.rest.pojo.dto.DeviceReportParamDto;
import com.njtoyo.taxi.admin.rest.presenter.business.DeviceReportPresenter;
import com.njtoyo.taxi.admin.rest.wrapper.business.device.DeviceReportQueryWrapper;
import com.njtoyo.taxi.admin.service.business.impl.DeviceReportServiceImpl;
import com.taxi.entity.common.RestResult;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@Api(value = "设备上报", tags = "设备上报")
@RequestMapping("business/deviceReport")
public class DeviceReportController {

    @Resource
    private DeviceReportServiceImpl deviceReportService;

    @PostMapping("/reportUpdateStatus")
    @PassToken
    public RestResult<Boolean> reportUpdateStatus(@RequestBody DeviceReportParamDto param) {
        return deviceReportService.reportDevice(param);
    }

    @GetMapping("/queryList")
    @PermissionScope(names = {"device_report_list"})
    public RestResult<Page<DeviceReportPresenter>> queryList(DeviceReportQueryWrapper param) {
        return deviceReportService.queryList(param);
    }
}
